<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script>
		window.location = 'https://docs.chemaxon.com/display/docs/marvin-js-troubleshooting.md';
	</script>
	<title>Marvin JS - Troubleshoot</title>
	<link type="text/css" rel="stylesheet" href="../css/doc.css" />

</head>

<body>
<h1>Marvin JS - Troubleshoot</h1>
<div style="clear: both; width: 100%; text-align: right;"><a href="index.html">Back to index</a></div>

<h2>Sketch does not appear in the iframe on my page</h2>

<ul>
<li><p>Please, check whether the reference to <strong>editor.html</strong> or <strong>editorws.html</strong> in the <strong>src</strong> attribute of the <strong>iframe</strong> is correct.</p></li>
<li><p>Sketch requires HTML5 canvas. Please, check whether your browser support <strong>HTML5 canvas</strong>. It is not available in old browsers like IE8.</p></li>
</ul>

<h2><a name="2dcleanDropsError"></a>2D clean drops error</h2>
<p>Please, note that 2D coordinate calculation is performed at server side. Marvin JS posts the structure to the Clean2D web service that generates the new coordinates and sends it back to the editor in an MRV.
The clean 2D operation can fail if
<ul>
	<li>The web service is not available on the expected URL.</li>
	<li>The browser may block the communication between Marvin JS and the server since it harms the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">same orgin policy</a> of the browser.</li>
	<li>Internal server error occurs during performing the calculation.</li>
</ul>
<p>Please, check that web service is available and it is installed properly, see the <a href="installationguide.html">installation guide</a> of Marvin JS.
If it is necessary, consult with the system administrator of the server that hosts the web services.</p>
</p>

<h2>Stereo calculation drops error</h2>
<p>It uses Stereo Info web service to calculate stereo info. It may be the same problem than <a href="#2dcleanDropsError">2D clean issue</a>.

<h2>SMILES format does not work in Open and in Save dialog</h2>
<p>SMILES import/export requires MolConvert web service. If it is configured for the editor but it cannot be accessed, you can get an error message.
Conversion can fail in the similar cases than <a href="#2dcleanDropsError">2D clean fails</a>.</p>

<h2>Download button in Save dialog does nothing</h2>
<p>This error may appear in the following situation:</p>
<ul>
	<li><p>Desired output format is different than MDL molfile or Marvin Document (output file is generated on the remote server by the MolConvert Webservice).</p></li>
	<li><p>The web page where Marvin JS is embedded is accessed via HTTP secure protocol (its URL address starts with <code>https://</code>).</p></li>
	<li><p>A proxy is configured as a frontend for Tomcat servlet container (where MolConvert Webservice is located) and the proxy is configured for https while Tomcat not.</p></li>
</ul>
<p>In this case, the URL of the output file generated by the webservice is incorrect: starts with <code>http</code> instead of <code>https</code>.
The browser will block downloading this unsecure content in current secure environment. On the JavaScript console you can find the trace of the blocking.</p>
<h4>Solution</h4>
<p>To resolve the issue, modify the <strong>proxy settings</strong>:
<ul>
<li><p>If the proxy is apache: <code>RequestHeader set X-Forwarded-Proto "https"</code></p></li>
<li><p>If the proxy is nginx: <code>more_set_headers "X-Forwarded-Proto: https";</code></p></li>
</ul>
then edit Tomcat <strong>server.xml</strong>: add the following to the <code>&lt;Host&gt;</code> section:
<pre style="padding: 0px;">&lt;Valve className="org.apache.catalina.valves.RemoteIpValve"
remoteIpHeader="x-forwarded-for"
remoteIpProxiesHeader="x-forwarded-by"
protocolHeader="x-forwarded-proto"/&gt;</pre>

There are other values that can be set and used: see <a href="https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/filters/RemoteIpFilter.html">Tomcat documentation</a></p>

<div style="clear: both; width: 100%; text-align: right;"><a href="index.html">Back to index</a></div>

<h2>At the first time after updating the package on the site, the editor is not launched.</h2>
<p>It may be a browser caching issue. This problem occurs when the content of Marvin JS package is modified (replace to a new version) but the browser still attempts to load the old one.
Since the browser has already cached the old version earlier, it tries to prefer the cached version instead of the new one.
In most cases, the user may not realize that the browser loads out-dated resources by running the editor. He faces with the issue when an out-dated resource requires any resource
that does exist anymore on the server.</p>
<p>To resolve the issue, purge out-dated content from this cache. If you apply a <strong>Shift+Reload</strong> on the current page, browser refreshes only those content in the local cache that belongs to this page.
Clearing of the whole browser cache also resolves the issue.
</p>
<p>If you would like to prevent your users to run into this issue, modify the configuration of the server where Marvin JS package is hosted.
When the web server hosts a content, it can indicate that it is cacheable or not.
As the browser receives the content, it considers to cache it by those information that the server wrote in the header of the content.
These info can be the expiration date or various caching directives.</p>
<p>The best practice is skipping the caching of each file (from Marvin JS package) whose name contains the <code>.nocache.</code> pattern.</p>
<h3>Apache2</h3>
If Marvin JS package is hosted by an Apache server, the recommended settings is specifying a <code>Cache-Control</code> directive the HTTP headers of those files where the given pattern match.
When you modify its config file, please, check whether the <a href="http://httpd.apache.org/docs/current/mod/mod_expires.html">mod_expires</a> module is switched on.
<pre>&lt;ifmodule mod_expires.c&gt;
  &lt;Files *.nocache.*&gt;
    ExpiresActive on
    ExpiresDefault "access"
    Header merge Cache-Control "public, max-age=0, must-revalidate"
  &lt;/Files&gt;
&lt;/ifmodule&gt;</pre>
<h3>Tomcat 7</h3>
<p>If Marvin JS is wrapped into a web application, there is the chance to control what directives appear in the HTTP headers of web application contents.
Under Tomcat 7, you can apply a <a href="http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html">built in filter</a> or define a new one to modify HTTP headers for your web application.
Please consult with the manual of your servlet container, how to switch off caching for each file whose name contains the <code>.nocache.</code> pattern.</p>
<p>If you manage to achieve that the response header contains the following lines at <code>*.nocache.*</code> files, it is enough to prevent their caching.
<pre>Cache-Control	no-cache, no-store
Pragma	no-cache</pre></p>

</body>
</html>
